//
//  Init.h
//  ActiveDeck
//
//  Created by Chiao-Wei Liu on 2011/2/7.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GDataXMLNode.h"
#import "Actions.h"

@class GDataXMLNode;
@class AD_Button;
@class AD_TextBox;
@class AD_Page;
@class AD_Slide;
@class AD_Category;
@class AD_Word;
@class AD_Kiosk;
@class AD_Image;
@class AD_Action;
@class AD_WebView;

@class HttpRequest;

@interface Init : NSObject <UIAlertViewDelegate> {
	BOOL Resume;
    BOOL cancel;
	NSError *xmlError;
	int PID;
	int iVersion;
	float progress;
	NSString *xmlnsLink;
	NSMutableArray *mu_Arr_Resources;
	NSMutableArray *mu_Arr_Slides;
    AD_Kiosk *Conf_Kiosk;
    NSMutableArray *pagesVisited;
	
    id _delegate;
	
    NSString *m_ResourcePath;
    NSString *m_ConfigPath;
    
    BOOL canExportToPDF;
    BOOL hasSecondarySubscription;
    
    NSString *webServiceEndPoint;
    NSString *channelFormat;
    
    BOOL shouldDownload;
    
    NSString *configXMLString;
    NSString *xmlFilePath;
    NSString *PresentDir;
    NSString *Authentication;
}
@property (readwrite) float progress;
@property (readwrite) BOOL Resume;
@property (readwrite) BOOL cancel;
@property (readwrite) int iVersion;
@property (readwrite) int PID;
@property (readwrite) BOOL canExportToPDF;
@property (readwrite) BOOL hasSecondarySubscription;

@property (nonatomic, retain) NSMutableArray *mu_Arr_Slides;
@property (nonatomic, retain) NSMutableArray *mu_Arr_Resources;
@property (nonatomic, retain) NSString *xmlnsLink;
@property (nonatomic, retain) NSError *xmlError;

@property (nonatomic, retain) AD_Kiosk *Conf_Kiosk;

@property (nonatomic, retain) NSString *m_ResourcePath;
@property (nonatomic, retain) NSString *m_ConfigPath;

@property (nonatomic, retain) NSString *webServiceEndPoint;
@property (nonatomic, retain) NSString *channelFormat;

@property (nonatomic, retain) NSMutableArray *pagesVisited;

@property (readwrite) BOOL shouldDownload;
@property (nonatomic, retain) NSString *configXMLString;
@property (nonatomic, retain) NSString *xmlFilePath;
@property (nonatomic, retain) NSString *PresentDir;
@property (nonatomic, retain) NSString *Authentication;

-(AD_Slide*)SetHomeEndPage:(AD_Image*) imageOB
                   SlideID:(int)SlideID;

-(BOOL)InitialConfig:(int)PresentID
	  Authentication:(NSString *)Authentication
         HasInternet:(BOOL)HasInternet;

-(id)delegate;
-(void)setDelegate:(id)delegate;

-(void)DownloadResource:(int)PresentID
			resourceDir:(NSString *)PresentFolder
            xmlFilePath:(NSString *)xmlPath
	   autheticationXML:(NSString *)authenticationXML;

-(void)LoadXML:(NSData *)xmlData
	PresentDir:(NSString *)PresentationDirectory;

-(void)CheckResume;
-(void)initializeCancel:(NSString *)PresentFolder;
-(void)DeleteLoopFiles:(NSString *)dirName;

-(BOOL)CheckVersion;
-(void)updateProgress;

-(AD_Button*)CreateButton:(GDataXMLElement *)button
               PresentDir:(NSString*)PresentationDirectory;

@end

@interface NSObject (ProgressBarDelegate)
-(void)BarUpdate:(float)Progress;
-(void)DisplayWaiting:(BOOL)display;
-(void)DisplayBlocked;
- (void)hideAll:(BOOL)shouldHide;
@end

